package com.lboyang.common.utils.concurrent.threadpool;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

/**
 * @Description: 自定义线程池
 * @Date 2021/9/11 20:22
 * @author: A.iguodala
 */
@Data
public class CustomThreadPoolConfig {

    /**
     * 核心线程数
     */
    private int corePoolSize = DEFAULT_CORE_POOL_SIZE;

    /**
     * 最大线程数
     */
    private int maximumPoolSize = DEFAULT_MAXIMUM_POOL_SIZE_SIZE;

    /**
     * 保活时间
     */
    private long keepAliveTime = DEFAULT_KEEP_ALIVE_TIME;

    /**
     * 时间单位
     */
    private TimeUnit unit = DEFAULT_TIME_UNIT;

    /**
     * 任务队列
     */
    private BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(BLOCKING_QUEUE_CAPACITY);


    /**
     * 线程池默认参数
     */
    private static final int DEFAULT_CORE_POOL_SIZE = 10;
    private static final int DEFAULT_MAXIMUM_POOL_SIZE_SIZE = 100;
    private static final int DEFAULT_KEEP_ALIVE_TIME = 1;
    private static final TimeUnit DEFAULT_TIME_UNIT = TimeUnit.MINUTES;
    private static final int DEFAULT_BLOCKING_QUEUE_CAPACITY = 100;
    private static final int BLOCKING_QUEUE_CAPACITY = 100;

}
